using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("VAllMessage", null, "Wicresoft.Messages.ConnectionString")]
	public class VAllMessage : ViewInfo
	{
		#region SQL column name consts 
		public const string SQLCOL_MESSAGEID = "MessageID";
		public const string SQLCOL_CREATETIME = "CreateTime";
		public const string SQLCOL_MODULEID = "ModuleID";
		public const string SQLCOL_TITLE = "Title";
		public const string SQLCOL_TEXT = "Text";
		public const string SQLCOL_MESSAGESTATUS = "MessageStatus";
		public const string SQLCOL_LASTOPERATIONTIME = "LastOperationTime";
		public const string SQLCOL_SENDERNAME = "SenderName";
		public const string SQLCOL_SENDERDISPLAYNAME = "SenderDisplayName";
		public const string SQLCOL_RECEIVERS = "Receivers";
		public const string SQLCOL_SENDTIME = "SendTime";
		public const string SQLCOL_PROCESSSTATUS = "ProcessStatus";
		public const string SQLCOL_PROCESSTIME = "ProcessTime";
		public const string SQLCOL_PROCESSCOUNT = "ProcessCount";
		public const string SQLCOL_NOTIFYURL = "NotifyUrl";
		public const string SQLCOL_TAG = "Tag";
		public const string SQLCOL_NEEDFEEDBACK = "NeedFeedBack";
		public const string SQLCOL_TIMEOUT = "TimeOut";
		public const string SQLCOL_PRIORITY = "Priority";
		public const string SQLCOL_APPLICATION = "Application";
		public const string SQLCOL_MODULENAME = "ModuleName";
		public const string SQLCOL_MODULEDISPLAYNAME = "ModuleDisplayName";
		public const string SQLCOL_DEVICES = "Devices";
		public const string SQLCOL_TEMPLATEINFO = "TemplateInfo";
		public const string SQLCOL_DESCRIPTION = "Description";
		#endregion


		#region Contructors
		/// <summary>
		/// Construct empty entity
		/// </summary>
		public VAllMessage () {}

		#endregion

		public override void Init (DataRow row)
		{
			MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
			CreateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_CREATETIME]);
			ModuleID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MODULEID]);
			Title = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TITLE]);
			Text = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEXT]);
			MessageStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_MESSAGESTATUS]);
			LastOperationTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_LASTOPERATIONTIME]);
			SenderName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERNAME]);
			SenderDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERDISPLAYNAME]);
			Receivers = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERS]);
			SendTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_SENDTIME]);
			ProcessStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSSTATUS]);
			ProcessTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_PROCESSTIME]);
			ProcessCount = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSCOUNT]);
			NotifyUrl = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_NOTIFYURL]);
			Tag = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TAG]);
			NeedFeedBack = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_NEEDFEEDBACK]);
			TimeOut = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_TIMEOUT]);
			Priority = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PRIORITY]);
			Application = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_APPLICATION]);
			ModuleName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MODULENAME]);
			ModuleDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MODULEDISPLAYNAME]);
			Devices = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICES]);
			TemplateInfo = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEMPLATEINFO]);
			Description = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DESCRIPTION]);
		}

		#region Properties 
		#region Property <Guid> MessageID
		[Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
		public Guid MessageID 
		{
			get { return _MessageID; }
			set { _MessageID = value; }
		}
		private Guid _MessageID = Guid.Empty;
		#endregion

		#region Property <DateTime> CreateTime
		[Property("CreateTime", 16, SqlDbType.DateTime, false, false)]
		public DateTime CreateTime 
		{
			get { return _CreateTime; }
			set { _CreateTime = value; }
		}
		private DateTime _CreateTime = DateTime.MinValue;
		#endregion

		#region Property <Guid> ModuleID
		[Property("ModuleID", 16, SqlDbType.UniqueIdentifier, false, false)]
		public Guid ModuleID 
		{
			get { return _ModuleID; }
			set { _ModuleID = value; }
		}
		private Guid _ModuleID = Guid.Empty;
		#endregion

		#region Property <string> Title
		[Property("Title", 2147483646, SqlDbType.NText, false, false)]
		public string Title 
		{
			get { return _Title; }
			set { _Title = value; }
		}
		private string _Title = null;
		#endregion

		#region Property <string> Text
		[Property("Text", 2147483646, SqlDbType.NText, false, false)]
		public string Text 
		{
			get { return _Text; }
			set { _Text = value; }
		}
		private string _Text = null;
		#endregion

		#region Property <int> MessageStatus
		[Property("MessageStatus", 4, SqlDbType.Int, false, false)]
		public int MessageStatus 
		{
			get { return _MessageStatus; }
			set { _MessageStatus = value; }
		}
		private int _MessageStatus = int.MinValue;
		#endregion

		#region Property <DateTime> LastOperationTime
		[Property("LastOperationTime", 16, SqlDbType.DateTime, false, false)]
		public DateTime LastOperationTime 
		{
			get { return _LastOperationTime; }
			set { _LastOperationTime = value; }
		}
		private DateTime _LastOperationTime = DateTime.MinValue;
		#endregion

		#region Property <string> SenderName
		[Property("SenderName", 100, SqlDbType.NVarChar, false, false)]
		public string SenderName 
		{
			get { return _SenderName; }
			set { _SenderName = value; }
		}
		private string _SenderName = null;
		#endregion

		#region Property <string> SenderDisplayName
		[Property("SenderDisplayName", 100, SqlDbType.NVarChar, false, false)]
		public string SenderDisplayName 
		{
			get { return _SenderDisplayName; }
			set { _SenderDisplayName = value; }
		}
		private string _SenderDisplayName = null;
		#endregion

		#region Property <string> Receivers
		[Property("Receivers", 2147483646, SqlDbType.NText, false, false)]
		public string Receivers 
		{
			get { return _Receivers; }
			set { _Receivers = value; }
		}
		private string _Receivers = null;
		#endregion

		#region Property <DateTime> SendTime
		[Property("SendTime", 16, SqlDbType.DateTime, false, false)]
		public DateTime SendTime 
		{
			get { return _SendTime; }
			set { _SendTime = value; }
		}
		private DateTime _SendTime = DateTime.MinValue;
		#endregion

		#region Property <int> ProcessStatus
		[Property("ProcessStatus", 4, SqlDbType.Int, false, false)]
		public int ProcessStatus 
		{
			get { return _ProcessStatus; }
			set { _ProcessStatus = value; }
		}
		private int _ProcessStatus = int.MinValue;
		#endregion

		#region Property <DateTime> ProcessTime
		[Property("ProcessTime", 16, SqlDbType.DateTime, false, false)]
		public DateTime ProcessTime 
		{
			get { return _ProcessTime; }
			set { _ProcessTime = value; }
		}
		private DateTime _ProcessTime = DateTime.MinValue;
		#endregion

		#region Property <int> ProcessCount
		[Property("ProcessCount", 4, SqlDbType.Int, false, false)]
		public int ProcessCount 
		{
			get { return _ProcessCount; }
			set { _ProcessCount = value; }
		}
		private int _ProcessCount = int.MinValue;
		#endregion

		#region Property <string> NotifyUrl
		[Property("NotifyUrl", 2147483646, SqlDbType.NText, false, false)]
		public string NotifyUrl 
		{
			get { return _NotifyUrl; }
			set { _NotifyUrl = value; }
		}
		private string _NotifyUrl = null;
		#endregion

		#region Property <string> Tag
		[Property("Tag", 2147483646, SqlDbType.NText, false, false)]
		public string Tag 
		{
			get { return _Tag; }
			set { _Tag = value; }
		}
		private string _Tag = null;
		#endregion

		#region Property <bool> NeedFeedBack
		[Property("NeedFeedBack", 1, SqlDbType.Bit, false, false)]
		public bool NeedFeedBack 
		{
			get { return _NeedFeedBack; }
			set { _NeedFeedBack = value; }
		}
		private bool _NeedFeedBack = false;
		#endregion

		#region Property <DateTime> TimeOut
		[Property("TimeOut", 16, SqlDbType.DateTime, false, false)]
		public DateTime TimeOut 
		{
			get { return _TimeOut; }
			set { _TimeOut = value; }
		}
		private DateTime _TimeOut = DateTime.MinValue;
		#endregion

		#region Property <int> Priority
		[Property("Priority", 4, SqlDbType.Int, false, false)]
		public int Priority 
		{
			get { return _Priority; }
			set { _Priority = value; }
		}
		private int _Priority = int.MinValue;
		#endregion

		#region Property <Guid> Application
		[Property("Application", 16, SqlDbType.UniqueIdentifier, false, false)]
		public Guid Application 
		{
			get { return _Application; }
			set { _Application = value; }
		}
		private Guid _Application = Guid.Empty;
		#endregion

		#region Property <string> ModuleName
		[Property("ModuleName", 100, SqlDbType.NVarChar, false, false)]
		public string ModuleName 
		{
			get { return _ModuleName; }
			set { _ModuleName = value; }
		}
		private string _ModuleName = null;
		#endregion

		#region Property <string> ModuleDisplayName
		[Property("ModuleDisplayName", 100, SqlDbType.NVarChar, false, false)]
		public string ModuleDisplayName 
		{
			get { return _ModuleDisplayName; }
			set { _ModuleDisplayName = value; }
		}
		private string _ModuleDisplayName = null;
		#endregion

		#region Property <int> Devices
		[Property("Devices", 4, SqlDbType.Int, false, false)]
		public int Devices 
		{
			get { return _Devices; }
			set { _Devices = value; }
		}
		private int _Devices = int.MinValue;
		#endregion

		#region Property <string> TemplateInfo
		[Property("TemplateInfo", 2147483646, SqlDbType.NText, false, false)]
		public string TemplateInfo 
		{
			get { return _TemplateInfo; }
			set { _TemplateInfo = value; }
		}
		private string _TemplateInfo = null;
		#endregion

		#region Property <string> Description
		[Property("Description", 2147483646, SqlDbType.NText, false, false)]
		public string Description 
		{
			get { return _Description; }
			set { _Description = value; }
		}
		private string _Description = null;
		#endregion
		#endregion
	}
}
